import QtQuick 1.1
import com.nokia.symbian 1.1
import QtMobility.gallery 1.1
import ExifItemSymbian 1.0

Page {
    id: mainPage

    ExifItem{
        id: exifItem
    }

    Component{
        id: thumbnailDelegate

        Rectangle {
            id: thumbnailDelegateRectangle
            width: galleryView.cellWidth
            height: galleryView.cellHeight
            color: "transparent"
            radius: 5

            Image {
                id: itemImage
                source: url
                sourceSize.height: galleryView.cellHeight
                sourceSize.width: galleryView.cellWidth
                anchors.fill: parent
                anchors.margins: 5
                anchors.verticalCenter: parent.verticalCenter
                anchors.horizontalCenter: parent.horizontalCenter
                asynchronous: true
            }

            MouseArea{
                anchors.fill: parent
                onClicked: {
                    exifItem.getGpsPointer(itemImage.source)
                }
            }

            GridView.onAdd: NumberAnimation { target: thumbnailDelegateRectangle; property: "scale"; from: 0.0; to: 1.0; easing.type: Easing.OutQuad }
        }
    }

    GridView{
        id: galleryView
        anchors.fill: parent

        delegate: thumbnailDelegate
        focus: true

        model: DocumentGalleryModel{
            rootType: DocumentGallery.Image
            autoUpdate: true
            properties: ["url","created","dateTaken","lastModified"]
            sortProperties: ["created","dateTaken","lastModified"]
        }

        cellWidth: (width/3)-0.5
        cellHeight: cellWidth
    }
}
